package com.yuexun.dhdoctor.module.mythings.adapter;

import android.widget.AbsListView;
import android.widget.LinearLayout;
import android.widget.TextView;


import com.yuexun.dhdoctor.R;
import com.yuexun.dhdoctor.module.mythings.bean.TaskListBean;

import org.kymjs.kjframe.widget.AdapterHolder;
import org.kymjs.kjframe.widget.KJAdapter;

import java.util.Collection;

/**
 * Created by work-jx on 2016/8/31.
 */
public class ThingsOtherAdapter extends KJAdapter<TaskListBean> {

    public ThingsOtherAdapter(AbsListView view, Collection<TaskListBean> mDatas, int itemLayoutId) {
        super(view, mDatas, itemLayoutId);
    }

    @Override
    public void convert(AdapterHolder adapterHolder, TaskListBean taskListBean, boolean b) {
        TextView lastToType = (TextView) adapterHolder.getView(R.id.lastToType);
        LinearLayout item_bg = adapterHolder.getView(R.id.item_bg);
        if (taskListBean.getLastToType().equals("2")) {
            lastToType.setText("(部门处理)");
            lastToType.setTextColor(0xff135ac6);
            item_bg.setBackgroundResource(R.drawable.item_task_card_blue);
        } else if (taskListBean.getLastToType().equals("1")){
            lastToType.setText("(个人处理)");
            lastToType.setTextColor(0xff333333);
            item_bg.setBackgroundResource(R.drawable.item_task_card);
        } else if (taskListBean.getLastToType().equals("3")){
            lastToType.setText("(群组处理)");
            lastToType.setTextColor(0xff333333);
            item_bg.setBackgroundResource(R.drawable.item_task_card);
        }

        adapterHolder.setText(R.id.tv_name_and_position, taskListBean.getFromName());
        adapterHolder.setText(R.id.tv_task_post_date, taskListBean.getStartDate());
        adapterHolder.setText(R.id.tv_task_title, taskListBean.getTitle());
        adapterHolder.setText(R.id.tv_task_type, taskListBean.getConfigName());
    }
}
